package com.yixin.mapper;

import com.yixin.entity.Dept;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface DeptMapper {
    @Select("select id, name, is_del, create_time, update_time from dept where is_del = 0 order by id")
    List<Dept> findAll();

    @Update("update dept set is_del = 1 where id = #{id}")
    void deleteById(Integer id);

    @Insert("insert into dept(name, is_del, create_time, update_time) values(#{name}, #{isDel}, #{createTime}, #{updateTime})")
    void add(Dept dept);

    @Update("update dept set name = #{name}, update_time = #{updateTime} where id = #{id}")
    void update(Dept dept);

    @Select("select id, name, is_del, create_time, update_time from dept where id = #{id}")
    Dept findById(Integer id);
}
